		.msfirst
		
#define EQU     .EQU
#define ORG     .ORG
#define RMB     .BLOCK
#define FCB     .BYTE
#define FCC     .TEXT
#define FDB     .WORD
#define END	.END

#define equ     .EQU
#define org     .ORG
#define rmb     .BLOCK
#define fcb     .BYTE
#define fcc     .TEXT
#define fdb     .WORD
#define	end	.END

TCSR	EQU		$0008		; Timer Control Status Register
TIMER	EQU		$0009		; Counter
OCR	EQU		$000B		; Output Compare Register
OCV	EQU		$4206		; Output Compare interrupt Vector


;MC-10 clock is .89488625Mhz or 894.88625Khz
; We need 2.5Khz interrupts so divide 894.88625 (.89488625 Mhz) by 2.58 = 346.855135... or 347 when rounded.
; subtract 22 to get the value we need or 325 aka $0145
TVAL	EQU		$150			 0166		; Timer period - 22
TCSRVAL	EQU		$8			; bit settings for the TCSR
SVDP	EQU		$bfff		; sound and VDP control register address

		
		org		$5000
		ldx	$fff4
		stx	vec+1
		inx
		stx	vec2+1
		ldaa	#$40		;css=1	
		staa	TSVDP


;******************************************		
; set the Interrupt Control Vector
;******************************************
		sei
		

		LDAA	#$7e	;load 'jmp' instruction opcode
vec		STAA	OCV		;store into OCV vector
		LDX		#note		; store interrupt hander address after JMP instruction
vec2		STX		OCV+1
;******************************************	
;Enable the timer interrupt
;******************************************
		; set the timer duration
		LDD		#TVAL
		STD		OCR
	
		;reset the counter to $FFF8.
		ldd	#$fff8		;reset timer
		std	TIMER


		
		;Enable the timer interrupt
		LDAA	#TCSRVAL
		STAA	TCSR

		cli					;enable interrupts

		;endless loop
			
busy		jsr		plasma

		dec 		counter
		bne		busy		
		jsr		play2
	
		ldaa		#$e
		staa		counter

		BRA		busy

;******************************************************
;nc/nc 	= no toggle
;nc/c 	= toggle output
;c/nc 	= toggle output
;c/c   	= no toggle
;******************************************************
note
		LDAA	TCSR	; ack irq !
		stab	TIMER	; ack timer

		LDD	#TVAL   ; reset 
		STD	OCR	; timer


sum		ldd 	#$0000 
freq		addd 	#$0000
		std 	sum+1	
		bcs	tog	

sum2		ldd	#$0000	
		addd	freq2+1	
		std	sum2+1	
		bcc	notog	

output		ldaa	TSVDP		;get RAM copy of Sound and VDP setting
		eora  	#$80	
		staa	SVDP		;set the hardware


		rti

tog		ldd	sum2+1
freq2		addd	#$0000
		std	sum2+1
		bra	output

notog		ldaa	TSVDP		;get RAM copy of Sound and VDP setting	
		anda	#$7f
		staa	SVDP		;set the hardware


		rti


	
;************************************************
; OK SO FAR
;************************************************
	
play2
	ldx	#NOPAT

;	stx	$4000		;just show pointer on screen (test)
curnote	ldd	,x		;load 2 notes from pattern
	bpl	plnote		;pattern ends with $80 (-ve flag set)

curpat	ldx	#PATTERNS-2	;load pointer to patterns
	inx			
	inx			;bump pattern
	cpx	#PAT0-2		;end of patterns, time to loop
	blo	nxpat

	ldx	#PATTERNS	;first pattern (rem out for loop to another point)
nxpat	stx	curpat+1
	ldx	,x		;load pointer to notes
	ldd	,x		;(replace with bra curnote if there are ever blank patterns)

plnote	inx
	inx
	stx	play2+1
	asld			;*2 for for lookup
	staa	ok1+1
	stab	ok2+1

	ldx	#freqtab	;freq table pointer	
ok1	ldd	0,x		;get the right freq
stor1	std	freq+1		;store
ok2	ldd	0,x		;get the freq for chan2
stor2	std	freq2+1
;************************************************

out	 rts


plasma

p2		ldx	sinptr
		ldab	,x
		addb	offs
		lsrb

ctbase		ldx	#coltab		
stp3		abx

ctb2		ldd	,x
		std	$4000
		ldd	2,x
		std	$4002
		ldd	4,x
		std	$4004
		ldd	6,x
		std	$4006		
		ldd	8,x		
		std	$4008		
		ldd	10,x		
		std	$400a		
		ldd	12,x		
		std	$400c			
		ldd	14,x		
		std	$400e		
		ldd	16,x		
		std	$4010		
		ldd	18,x		
		std	$4012		
		ldd	20,x		
		std	$4014		
		ldd	22,x		
		std	$4016		
		ldd	24,x		
		std	$4018		
		ldd	26,x		
		std	$401a			
		ldd	28,x
		std	$401c
		ldd	30,x
		std	$401e

;***************************************************
; line2
;***************************************************

		ldaa	sinptr+1
		adda	step		
		staa	sinptr+1

		ldx	sinptr
		ldab	,x
		addb	offs
		lsrb

		ldx	#coltab		
		abx

		ldd	,x
		std	$4020
		ldd	2,x
		std	$4022
		ldd	4,x
		std	$4024
		ldd	6,x
		std	$4026		
		ldd	8,x		
		std	$4028		
		ldd	10,x		
		std	$402a		
		ldd	12,x		
		std	$402c			
		ldd	14,x		
		std	$402e		
		ldd	16,x		
		std	$4030		
		ldd	18,x		
		std	$4032		
		ldd	20,x		
		std	$4034		
		ldd	22,x		
		std	$4036		
		ldd	24,x		
		std	$4038		
		ldd	26,x		
		std	$403a			
		ldd	28,x
		std	$403c
		ldd	30,x
		std	$403e





;***************************************************
; line3
;***************************************************

		ldaa	sinptr+1
		adda	step		
		staa	sinptr+1

		ldx	sinptr
		ldab	,x
		addb	offs
		lsrb

		ldx	#coltab		
		abx

		ldd	,x
		std	$4040
		ldd	2,x
		std	$4042
		ldd	4,x
		std	$4044
		ldd	6,x
		std	$4046		
		ldd	8,x		
		std	$4048		
		ldd	10,x		
		std	$404a		
		ldd	12,x		
		std	$404c			
		ldd	14,x		
		std	$404e		
		ldd	16,x		
		std	$4050		
		ldd	18,x		
		std	$4052		
		ldd	20,x		
		std	$4054		
		ldd	22,x		
		std	$4056		
		ldd	24,x		
		std	$4058		
		ldd	26,x		
		std	$405a			
		ldd	28,x
		std	$405c
		ldd	30,x
		std	$405e






;***************************************************
; line4
;***************************************************

		ldaa	sinptr+1
		adda	step		
		staa	sinptr+1

		ldx	sinptr
		ldab	,x
		addb	offs
		lsrb

		ldx	#coltab		
		abx

		ldd	,x
		std	$4060
		ldd	2,x
		std	$4062
		ldd	4,x
		std	$4064
		ldd	6,x
		std	$4066		
		ldd	8,x		
		std	$4068		
		ldd	10,x		
		std	$406a		
		ldd	12,x		
		std	$406c			
		ldd	14,x		
		std	$406e		
		ldd	16,x		
		std	$4070		
		ldd	18,x		
		std	$4072		
		ldd	20,x		
		std	$4074		
		ldd	22,x		
		std	$4076		
		ldd	24,x		
		std	$4078		
		ldd	26,x		
		std	$407a			
		ldd	28,x
		std	$407c
		ldd	30,x
		std	$407e



;***************************************************
; line5
;***************************************************

		ldaa	sinptr+1
		adda	step		
		staa	sinptr+1

		ldx	sinptr
		ldab	,x
		addb	offs
		lsrb

		ldx	#coltab		
		abx

		ldd	,x
		std	$4080
		ldd	2,x
		std	$4082
		ldd	4,x
		std	$4084
		ldd	6,x
		std	$4086		
		ldd	8,x		
		std	$4088		
		ldd	10,x		
		std	$408a		
		ldd	12,x		
		std	$408c			
		ldd	14,x		
		std	$408e		
		ldd	16,x		
		std	$4090		
		ldd	18,x		
		std	$4092		
		ldd	20,x		
		std	$4094		
		ldd	22,x		
		std	$4096		
		ldd	24,x		
		std	$4098		
		ldd	26,x		
		std	$409a			
		ldd	28,x
		std	$409c
		ldd	30,x
		std	$409e


;***************************************************
; line6
;***************************************************

		ldaa	sinptr+1
		adda	step		
		staa	sinptr+1

		ldx	sinptr
		ldab	,x
		addb	offs
		lsrb

		ldx	#coltab		
		abx

		ldd	,x
		std	$40a0
		ldd	2,x
		std	$40a2
		ldd	4,x
		std	$40a4
		ldd	6,x
		std	$40a6		
		ldd	8,x		
		std	$40a8		
		ldd	10,x	
		std	$40aa		
		ldd	12,x		
		std	$40ac			
		ldd	14,x		
		std	$40ae		
		ldd	16,x		
		std	$40b0		
		ldd	18,x		
		std	$40b2		
		ldd	20,x		
		std	$40b4		
		ldd	22,x		
		std	$40b6		
		ldd	24,x		
		std	$40b8		
		ldd	26,x		
		std	$40ba			
		ldd	28,x
		std	$40bc
		ldd	30,x
		std	$40be




;***************************************************
; line7
;***************************************************

		ldaa	sinptr+1
		adda	step		
		staa	sinptr+1

		ldx	sinptr
		ldab	,x
		addb	offs
		lsrb

		ldx	#coltab		
		abx

		ldd	,x
		std	$40c0
		ldd	2,x
		std	$40c2
		ldd	4,x
		std	$40c4
		ldd	6,x
		std	$40c6		
		ldd	8,x		
		std	$40c8		
		ldd	10,x		
		std	$40ca		
		ldd	12,x		
		std	$40cc			
		ldd	14,x		
		std	$40ce		
		ldd	16,x		
		std	$40d0		
		ldd	18,x		
		std	$40d2		
		ldd	20,x		
		std	$40d4		
		ldd	22,x		
		std	$40d6		
		ldd	24,x		
		std	$40d8		
		ldd	26,x		
		std	$40da			
		ldd	28,x
		std	$40dc
		ldd	30,x
		std	$40de


;***************************************************
; line8
;***************************************************

		ldaa	sinptr+1
		adda	step		
		staa	sinptr+1

		ldx	sinptr
		ldab	,x
		addb	offs
		lsrb

		ldx	#coltab		
		abx

		ldd	,x
		std	$40e0
		ldd	2,x
		std	$40e2
		ldd	4,x
		std	$40e4
		ldd	6,x
		std	$40e6		
		ldd	8,x		
		std	$40e8		
		ldd	10,x		
		std	$40ea		
		ldd	12,x		
		std	$40ec			
		ldd	14,x		
		std	$40ee		
		ldd	16,x		
		std	$40f0		
		ldd	18,x		
		std	$40f2		
		ldd	20,x		
		std	$40f4		
		ldd	22,x		
		std	$40f6		
		ldd	24,x		
		std	$40f8		
		ldd	26,x		
		std	$40fa			
		ldd	28,x
		std	$40fc
		ldd	30,x
		std	$40fe


;***************************************************
; line9
;***************************************************

		ldaa	sinptr+1
		adda	step		
		staa	sinptr+1

		ldx	sinptr
		ldab	,x
		addb	offs
		lsrb

		ldx	#coltab		
		abx

		ldd	,x
		std	$4100
		ldd	2,x
		std	$4102
		ldd	4,x
		std	$4104
		ldd	6,x
		std	$4106		
		ldd	8,x		
		std	$4108		
		ldd	10,x		
		std	$410a		
		ldd	12,x		
		std	$410c			
		ldd	14,x		
		std	$410e		
		ldd	16,x		
		std	$4110		
		ldd	18,x		
		std	$4112		
		ldd	20,x		
		std	$4114		
		ldd	22,x		
		std	$4116		
		ldd	24,x		
		std	$4118		
		ldd	26,x		
		std	$411a			
		ldd	28,x
		std	$411c
		ldd	30,x
		std	$411e


;***************************************************
; line10
;***************************************************

		ldaa	sinptr+1
		adda	step		
		staa	sinptr+1

		ldx	sinptr
		ldab	,x
		addb	offs
		lsrb

		ldx	#coltab		
		abx

		ldd	,x
		std	$4120
		ldd	2,x
		std	$4122
		ldd	4,x
		std	$4124
		ldd	6,x
		std	$4126		
		ldd	8,x		
		std	$4128		
		ldd	10,x		
		std	$412a		
		ldd	12,x		
		std	$412c			
		ldd	14,x		
		std	$412e		
		ldd	16,x		
		std	$4130		
		ldd	18,x		
		std	$4132		
		ldd	20,x		
		std	$4134		
		ldd	22,x		
		std	$4136		
		ldd	24,x		
		std	$4138		
		ldd	26,x		
		std	$413a			
		ldd	28,x
		std	$413c
		ldd	30,x
		std	$413e



;***************************************************
; line11
;***************************************************

		ldaa	sinptr+1
		adda	step		
		staa	sinptr+1

		ldx	sinptr
		ldab	,x
		addb	offs
		lsrb

		ldx	#coltab		
		abx

		ldd	,x
		std	$4140
		ldd	2,x
		std	$4142
		ldd	4,x
		std	$4144
		ldd	6,x
		std	$4146		
		ldd	8,x		
		std	$4148		
		ldd	10,x		
		std	$414a		
		ldd	12,x		
		std	$414c			
		ldd	14,x		
		std	$414e		
		ldd	16,x		
		std	$4150		
		ldd	18,x		
		std	$4152		
		ldd	20,x		
		std	$4154		
		ldd	22,x		
		std	$4156		
		ldd	24,x		
		std	$4158		
		ldd	26,x		
		std	$415a			
		ldd	28,x
		std	$415c
		ldd	30,x
		std	$415e


;***************************************************
; line12
;***************************************************

		ldaa	sinptr+1
		adda	step		
		staa	sinptr+1

		ldx	sinptr
		ldab	,x
		addb	offs
		lsrb

		ldx	#coltab		
		abx

		ldd	,x
		std	$4160
		ldd	2,x
		std	$4162
		ldd	4,x
		std	$4164
		ldd	6,x
		std	$4166		
		ldd	8,x		
		std	$4168		
		ldd	10,x		
		std	$416a		
		ldd	12,x		
		std	$416c			
		ldd	14,x		
		std	$416e		
		ldd	16,x		
		std	$4170		
		ldd	18,x		
		std	$4172		
		ldd	20,x		
		std	$4174		
		ldd	22,x		
		std	$4176		
		ldd	24,x		
		std	$4178		
		ldd	26,x		
		std	$417a			
		ldd	28,x
		std	$417c
		ldd	30,x
		std	$417e


;***************************************************
; line13
;***************************************************

		ldaa	sinptr+1
		adda	step		
		staa	sinptr+1

		ldx	sinptr
		ldab	,x
		addb	offs
		lsrb

		ldx	#coltab		
		abx

		ldd	,x
		std	$4180
		ldd	2,x
		std	$4182
		ldd	4,x
		std	$4184
		ldd	6,x
		std	$4186		
		ldd	8,x		
		std	$4188		
		ldd	10,x		
		std	$418a		
		ldd	12,x		
		std	$418c			
		ldd	14,x		
		std	$418e		
		ldd	16,x		
		std	$4190		
		ldd	18,x		
		std	$4192		
		ldd	20,x		
		std	$4194		
		ldd	22,x		
		std	$4196		
		ldd	24,x		
		std	$4198		
		ldd	26,x		
		std	$419a			
		ldd	28,x
		std	$419c
		ldd	30,x
		std	$419e


;***************************************************
; line14
;***************************************************

		ldaa	sinptr+1
		adda	step		
		staa	sinptr+1

		ldx	sinptr
		ldab	,x
		addb	offs
		lsrb

		ldx	#coltab		
		abx

		ldd	,x
		std	$41a0
		ldd	2,x
		std	$41a2
		ldd	4,x
		std	$41a4
		ldd	6,x
		std	$41a6		
		ldd	8,x		
		std	$41a8		
		ldd	10,x		
		std	$41aa		
		ldd	12,x		
		std	$41ac			
		ldd	14,x		
		std	$41ae		
		ldd	16,x		
		std	$41b0		
		ldd	18,x		
		std	$41b2		
		ldd	20,x		
		std	$41b4		
		ldd	22,x		
		std	$41b6		
		ldd	24,x		
		std	$41b8		
		ldd	26,x		
		std	$41ba			
		ldd	28,x
		std	$41bc
		ldd	30,x
		std	$41be


;***************************************************
; line15
;***************************************************

		ldaa	sinptr+1
		adda	step		
		staa	sinptr+1

		ldx	sinptr
		ldab	,x
		addb	offs
		lsrb

		ldx	#coltab		
		abx

		ldd	,x
		std	$41c0
		ldd	2,x
		std	$41c2
		ldd	4,x
		std	$41c4
		ldd	6,x
		std	$41c6		
		ldd	8,x		
		std	$41c8		
		ldd	10,x		
		std	$41ca		
		ldd	12,x		
		std	$41cc			
		ldd	14,x		
		std	$41ce		
		ldd	16,x		
		std	$41d0		
		ldd	18,x		
		std	$41d2		
		ldd	20,x		
		std	$41d4		
		ldd	22,x		
		std	$41d6		
		ldd	24,x		
		std	$41d8		
		ldd	26,x		
		std	$41da			
		ldd	28,x
		std	$41dc
		ldd	30,x
		std	$41de


;***************************************************
; line16
;***************************************************

		ldaa	sinptr+1
		adda	step		
		staa	sinptr+1

		ldx	sinptr
		ldab	,x
		addb	offs
		lsrb

		ldx	#coltab		
		abx

		ldd	,x
		std	$41e0
		ldd	2,x
		std	$41e2
		ldd	4,x
		std	$41e4
		ldd	6,x
		std	$41e6		
		ldd	8,x		
		std	$41e8		
		ldd	10,x		
		std	$41ea		
		ldd	12,x		
		std	$41ec			
		ldd	14,x		
		std	$41ee		
		ldd	16,x		
		std	$41f0		
		ldd	18,x		
		std	$41f2		
		ldd	20,x		
		std	$41f4		
		ldd	22,x		
		std	$41f6		
		ldd	24,x		
		std	$41f8		
		ldd	26,x		
		std	$41fa			
		ldd	28,x
		std	$41fc
		ldd	30,x
		std	$41fe






;***************************************************	
done_yloop	

;***************************************************
; once per frame
;***************************************************
speed		ldaa	#0	
		deca
		staa	speed+1
		staa	sinptr+1

		clr	offs+1
	
		rts		

sinptr		fdb	sintab
offs		fdb	sintab
step		fcb	5



;**************************************
; color defs
;**************************************
black		equ		$80
dk_orange	equ		$20
br_orange	equ		$60
green		equ		$8f
yellow		equ		$9f
blue		equ		$af
red		equ		$bf
white		equ		$cf
cyan		equ		$df
magenta		equ		$ef
orange		equ		$ff



		.ORG  (($ + 0FFH) & 0FF00H)
	
coltab
		.fill	2,black
		.fill	2,dk_orange
		.fill	2,red
		.fill	2,orange
		.fill	2,br_orange
		.fill	2,yellow
		.fill	2,white
		.fill	2,white
		.fill	2,white
		.fill	2,yellow
		.fill	2,br_orange
		.fill	2,orange
		.fill	2,red
		.fill	2,dk_orange
		.fill	2,red
		.fill	2,blue
		.fill	2,red
		.fill	2,magenta
		.fill	2,blue
		.fill	2,magenta
		.fill	2,red
		.fill	2,blue
		.fill	2,red
		.fill	2,orange
		.fill	2,br_orange
		.fill	2,yellow
		.fill	2,green
		.fill	2,yellow
		.fill	2,br_orange
		.fill	2,orange
		.fill	2,red
		.fill	2,dk_orange		;64


		.fill	2,black
		.fill	2,dk_orange
		.fill	2,red
		.fill	2,orange
		.fill	2,br_orange
		.fill	2,yellow
		.fill	2,white
		.fill	2,white
		.fill	2,white
		.fill	2,yellow
		.fill	2,br_orange
		.fill	2,orange
		.fill	2,red
		.fill	2,dk_orange
		.fill	2,red
		.fill	2,blue
		.fill	2,red
		.fill	2,magenta
		.fill	2,blue
		.fill	2,magenta
		.fill	2,red
		.fill	2,blue
		.fill	2,red
		.fill	2,orange
		.fill	2,br_orange
		.fill	2,yellow
		.fill	2,green
		.fill	2,yellow
		.fill	2,br_orange
		.fill	2,orange
		.fill	2,red
		.fill	2,dk_orange		;64


		.fill	2,black
		.fill	2,dk_orange
		.fill	2,red
		.fill	2,orange
		.fill	2,br_orange
		.fill	2,yellow
		.fill	2,white
		.fill	2,white
		.fill	2,white
		.fill	2,yellow
		.fill	2,br_orange
		.fill	2,orange
		.fill	2,red
		.fill	2,dk_orange
		.fill	2,red
		.fill	2,blue
		.fill	2,red
		.fill	2,magenta
		.fill	2,blue
		.fill	2,magenta
		.fill	2,red
		.fill	2,blue
		.fill	2,red
		.fill	2,orange
		.fill	2,br_orange
		.fill	2,yellow
		.fill	2,green
		.fill	2,yellow
		.fill	2,br_orange
		.fill	2,orange
		.fill	2,red
		.fill	2,dk_orange		;64


		.fill	2,black
		.fill	2,dk_orange
		.fill	2,red
		.fill	2,orange
		.fill	2,br_orange
		.fill	2,yellow
		.fill	2,white
		.fill	2,white
		.fill	2,white
		.fill	2,yellow
		.fill	2,br_orange
		.fill	2,orange
		.fill	2,red
		.fill	2,dk_orange
		.fill	2,red
		.fill	2,blue
		.fill	2,red
		.fill	2,magenta
		.fill	2,blue
		.fill	2,magenta
		.fill	2,red
		.fill	2,blue
		.fill	2,red
		.fill	2,orange
		.fill	2,br_orange
		.fill	2,yellow
		.fill	2,green
		.fill	2,yellow
		.fill	2,br_orange
		.fill	2,orange
		.fill	2,red
		.fill	2,dk_orange		;64


;**************************************
; coltab
;**************************************
;coltab		coltab_b
;		coltab_b
;		coltab_b
;		coltab_b

;**************************************
; page aligned sintab
;**************************************
sintab


		fcb	0,-1,-2,-3,-4,-5,-6,-7
		fcb	-8,-9,-10,-11,-12,-13,-14,-15
		fcb	-16,-17,-18,-19,-20,-21,-22,-22
		fcb	-23,-24,-25,-26,-27,-27,-28,-29
		fcb	-30,-30,-31,-32,-32,-33,-34,-34
		fcb	-35,-35,-36,-37,-37,-38,-38,-38
		fcb	-39,-39,-40,-40,-40,-40,-41,-41
		fcb	-41,-41,-42,-42,-42,-42,-42,-42
		fcb	-42,-42,-42,-42,-42,-42,-42,-41
		fcb	-41,-41,-41,-40,-40,-40,-40,-39
		fcb	-39,-38,-38,-38,-37,-37,-36,-35
		fcb	-35,-34,-34,-33,-32,-32,-31,-30
		fcb	-30,-29,-28,-27,-27,-26,-25,-24
		fcb	-23,-22,-22,-21,-20,-19,-18,-17
		fcb	-16,-15,-14,-13,-12,-11,-10,-9
		fcb	-8,-7,-6,-5,-4,-3,-2,-1

		fcb	0,1,2,3,4,5,6,7
		fcb	8,9,10,11,12,13,14,15
		fcb	16,17,18,19,20,21,22,22
		fcb	23,24,25,26,27,27,28,29
		fcb	30,30,31,32,32,33,34,34
		fcb	35,35,36,37,37,38,38,38
		fcb	39,39,40,40,40,40,41,41
		fcb	41,41,42,42,42,42,42,42

		fcb	42,42,42,42,42,42,42,41
		fcb	41,41,41,40,40,40,40,39
		fcb	39,38,38,38,37,37,36,35
		fcb	35,34,34,33,32,32,31,30
		fcb	30,29,28,27,27,26,25,24
		fcb	23,22,22,21,20,19,18,17
		fcb	16,15,14,13,12,11,10,9
		fcb	8,7,6,5,4,3,2,1




;******************************************************
;equal tempered 12 note per octave frequency table
;******************************************************
		.ORG  (($ + 0FFH) & 0FF00H)

freqtab		fdb	0,0,0,0,0,0,0,0,0,0,0,0

		fdb	0,577,611,647,686,727,770,816,864,915,970,1028
		fdb	1089,1153,1222,1295,1372,1453,1540,1631,1728,1831,1940,2055
		fdb	2177,2307,2444,2589,2743,2906,3079,3262,3456,3662,3879,4110
		fdb	4355,4613,4888,5178,5486,5813,6158,6524,6912,7323,7759,8220
		fdb	8709,9227,9775,10357,10972,11625,12316,13049,13825,14647,15518,16440
	

TSVDP		fcb 	$00			;Temporary Sound and VDP settings
counter		fcb	$e

;******************************************************
; PATTERN POINTERS
;******************************************************

PATLOOP
PATTERNS
	fdb PAT0
	fdb PAT0
	fdb PAT0
	fdb PAT0
	fdb PAT0
	fdb PAT0
	fdb PAT0
	fdb PAT0
	fdb PAT9
	fdb PAT9
	fdb PAT9
	fdb PAT9
	fdb PAT9
	fdb PAT9
	fdb PAT9
	fdb PAT9
	fdb PAT1
	fdb PAT1
	fdb PAT1
	fdb PAT1
	fdb PAT2
	fdb PAT2
	fdb PAT2
	fdb PAT2
	fdb PAT3
	fdb PAT3
	fdb PAT3
	fdb PAT3
	fdb PAT4
	fdb PAT4
	fdb PAT4
	fdb PAT4
	fdb PAT1
	fdb PAT1
	fdb PAT1
	fdb PAT1
	fdb PAT2
	fdb PAT2
	fdb PAT2
	fdb PAT2
	fdb PAT3
	fdb PAT3
	fdb PAT3
	fdb PAT3
	fdb PAT4
	fdb PAT4
	fdb PAT4
	fdb PAT4
	fdb PAT10
	fdb PAT10
	fdb PAT10
	fdb PAT10
	fdb PAT11
	fdb PAT11
	fdb PAT11
	fdb PAT11
	fdb PAT12
	fdb PAT12
	fdb PAT12
	fdb PAT12
	fdb PAT13
	fdb PAT13
	fdb PAT14
	fdb PAT14
	fdb PAT11
	fdb PAT11
	fdb PAT11
	fdb PAT11
	fdb PAT12
	fdb PAT12
	fdb PAT12
	fdb PAT12
	fdb PAT13
	fdb PAT13
	fdb PAT13
	fdb PAT13
	fdb PAT14
	fdb PAT14
	fdb PAT14
	fdb PAT14
	fdb PAT5
	fdb PAT5
	fdb PAT5
	fdb PAT5
	fdb PAT6
	fdb PAT6
	fdb PAT6
	fdb PAT6
	fdb PAT7
	fdb PAT7
	fdb PAT7
	fdb PAT7
	fdb PAT8
	fdb PAT8
	fdb PAT8
	fdb PAT8
	fdb PAT5
	fdb PAT5
	fdb PAT5
	fdb PAT5
	fdb PAT6
	fdb PAT6
	fdb PAT6
	fdb PAT6
	fdb PAT7
	fdb PAT7
	fdb PAT7
	fdb PAT7
	fdb PAT8
	fdb PAT8
	fdb PAT8
	fdb PAT8
	fdb PAT15
	fdb PAT15
	fdb PAT15
	fdb PAT19
	fdb PAT20
	fdb PAT20
	fdb PAT20
	fdb PAT21
	fdb PAT22
	fdb PAT22
	fdb PAT22
	fdb PAT22
	fdb PAT23
	fdb PAT23
	fdb PAT23
	fdb PAT28
	fdb PAT24
	fdb PAT24
	fdb PAT24
	fdb PAT24
	fdb PAT25
	fdb PAT25
	fdb PAT25
	fdb PAT25
	fdb PAT26
	fdb PAT26
	fdb PAT26
	fdb PAT26
	fdb PAT27
	fdb PAT27
	fdb PAT27
	fdb PAT27
	fdb PAT24
	fdb PAT24
	fdb PAT24
	fdb PAT24
	fdb PAT25
	fdb PAT25
	fdb PAT25
	fdb PAT25
	fdb PAT26
	fdb PAT26
	fdb PAT26
	fdb PAT26
	fdb PAT27
	fdb PAT27
	fdb PAT27
	fdb PAT27
	fdb PAT29
	fdb PAT29
	fdb PAT29
	fdb PAT29
	fdb PAT30
	fdb PAT30
	fdb PAT30
	fdb PAT30
	fdb PAT31
	fdb PAT31
	fdb PAT31
	fdb PAT31
	fdb PAT32
	fdb PAT32
	fdb PAT32
	fdb PAT32
	fdb PAT17
	fdb PAT17
	fdb PAT33
	fdb PAT33
	fdb PAT18
	fdb 0

PAT0
	fcb $f,$f
	fcb $0,$0
	fcb $0,$0
	fcb $0,$0
	fcb $0,$0
	fcb $0,$0
	fcb $0,$0
	fcb $0,$0
	fcb $f,$f
	fcb $0,$0
	fcb $0,$0
	fcb $0,$0
	fcb $0,$0
	fcb $0,$0
	fcb $0,$0
	fcb $0,$0
NOPAT	fcb $80,$00

PAT1
	fcb $f,$f
	fcb $0,$0
	fcb $1b,$0
	fcb $22,$0
	fcb $f,$f
	fcb $0,$0
	fcb $33,$1b
	fcb $3a,$1b
	fcb $f,$f
	fcb $0,$33
	fcb $1b,$3a
	fcb $1b,$0
	fcb $f,$f
	fcb $0,$0
	fcb $f,$0
	fcb $f,$0
	fcb $80,$00

PAT2
	fcb $f,$f
	fcb $0,$0
	fcb $1b,$0
	fcb $22,$0
	fcb $f,$f
	fcb $0,$0
	fcb $31,$1b
	fcb $38,$1b
	fcb $f,$f
	fcb $0,$31
	fcb $1b,$38
	fcb $1b,$0
	fcb $f,$f
	fcb $0,$0
	fcb $f,$0
	fcb $f,$0
	fcb $80,$00

PAT3
	fcb $f,$f
	fcb $0,$0
	fcb $1b,$0
	fcb $22,$0
	fcb $f,$f
	fcb $0,$0
	fcb $2f,$1b
	fcb $36,$1b
	fcb $f,$f
	fcb $0,$2f
	fcb $1b,$36
	fcb $1b,$0
	fcb $f,$f
	fcb $0,$0
	fcb $f,$0
	fcb $f,$0
	fcb $80,$00

PAT4
	fcb $f,$f
	fcb $0,$0
	fcb $1b,$0
	fcb $22,$0
	fcb $f,$f
	fcb $0,$0
	fcb $2e,$1b
	fcb $35,$1b
	fcb $f,$f
	fcb $0,$2e
	fcb $1b,$35
	fcb $1b,$0
	fcb $f,$f
	fcb $0,$0
	fcb $f,$0
	fcb $f,$0
	fcb $80,$00

PAT5
	fcb $f,$f
	fcb $f,$0
	fcb $1b,$0
	fcb $22,$0
	fcb $f,$f
	fcb $f,$0
	fcb $33,$1b
	fcb $3a,$1b
	fcb $f,$f
	fcb $f,$33
	fcb $1b,$3a
	fcb $1b,$0
	fcb $f,$f
	fcb $f,$0
	fcb $1b,$f
	fcb $1b,$0
	fcb $80,$00

PAT6
	fcb $f,$f
	fcb $f,$0
	fcb $1b,$0
	fcb $22,$0
	fcb $f,$f
	fcb $f,$0
	fcb $31,$1b
	fcb $38,$1b
	fcb $f,$f
	fcb $f,$31
	fcb $1b,$38
	fcb $1b,$0
	fcb $f,$f
	fcb $f,$0
	fcb $1b,$f
	fcb $1b,$0
	fcb $80,$00

PAT7
	fcb $f,$f
	fcb $f,$0
	fcb $1b,$0
	fcb $22,$0
	fcb $f,$f
	fcb $f,$0
	fcb $2f,$1b
	fcb $36,$1b
	fcb $f,$f
	fcb $f,$2f
	fcb $1b,$36
	fcb $1b,$0
	fcb $f,$f
	fcb $f,$0
	fcb $1b,$f
	fcb $1b,$0
	fcb $80,$00

PAT8
	fcb $f,$f
	fcb $f,$0
	fcb $1b,$0
	fcb $22,$0
	fcb $f,$f
	fcb $f,$0
	fcb $2e,$1b
	fcb $35,$1b
	fcb $f,$f
	fcb $f,$2e
	fcb $1b,$35
	fcb $1b,$0
	fcb $f,$f
	fcb $f,$0
	fcb $1b,$f
	fcb $1b,$0
	fcb $80,$00

PAT9
	fcb $f,$f
	fcb $0,$0
	fcb $0,$0
	fcb $0,$0
	fcb $0,$f
	fcb $0,$0
	fcb $0,$0
	fcb $0,$0
	fcb $f,$f
	fcb $0,$0
	fcb $0,$0
	fcb $0,$0
	fcb $0,$f
	fcb $0,$0
	fcb $0,$0
	fcb $0,$0
	fcb $80,$00

PAT10
	fcb $f,$f
	fcb $f,$1b
	fcb $1b,$27
	fcb $1b,$1b
	fcb $f,$f
	fcb $f,$1b
	fcb $1b,$27
	fcb $1b,$1b
	fcb $f,$f
	fcb $f,$1b
	fcb $1b,$27
	fcb $1b,$1b
	fcb $f,$f
	fcb $f,$1b
	fcb $1b,$27
	fcb $1b,$1b
	fcb $80,$00

PAT11
	fcb $f,$f
	fcb $f,$1b
	fcb $1b,$2a
	fcb $1b,$1b
	fcb $f,$f
	fcb $f,$1b
	fcb $1b,$2a
	fcb $1b,$1b
	fcb $f,$f
	fcb $f,$1b
	fcb $1b,$2a
	fcb $1b,$1b
	fcb $f,$f
	fcb $f,$1b
	fcb $1b,$2a
	fcb $1b,$1b
	fcb $80,$00

PAT12
	fcb $f,$f
	fcb $f,$1b
	fcb $1b,$29
	fcb $1b,$1b
	fcb $f,$f
	fcb $f,$1b
	fcb $1b,$29
	fcb $1b,$1b
	fcb $f,$f
	fcb $f,$1b
	fcb $1b,$29
	fcb $1b,$1b
	fcb $f,$f
	fcb $f,$1b
	fcb $1b,$29
	fcb $1b,$1b
	fcb $80,$00

PAT13
	fcb $f,$f
	fcb $f,$1b
	fcb $1b,$22
	fcb $1b,$1b
	fcb $f,$f
	fcb $f,$1b
	fcb $1b,$22
	fcb $1b,$1b
	fcb $f,$f
	fcb $f,$1b
	fcb $1b,$22
	fcb $1b,$1b
	fcb $f,$f
	fcb $f,$1b
	fcb $1b,$22
	fcb $1b,$1b
	fcb $80,$00

PAT14
	fcb $f,$f
	fcb $f,$1b
	fcb $1b,$25
	fcb $1b,$1b
	fcb $f,$f
	fcb $f,$1b
	fcb $1b,$25
	fcb $1b,$1b
	fcb $f,$f
	fcb $f,$1b
	fcb $1b,$25
	fcb $1b,$1b
	fcb $f,$f
	fcb $f,$1b
	fcb $1b,$25
	fcb $1b,$1b
	fcb $80,$00

PAT15
	fcb $27,$27
	fcb $2e,$2e
	fcb $0,$0
	fcb $27,$0
	fcb $2e,$0
	fcb $0,$0
	fcb $0,$27
	fcb $0,$2e
	fcb $f,$0
	fcb $f,$27
	fcb $f,$2e
	fcb $f,$0
	fcb $f,$27
	fcb $f,$2e
	fcb $f,$0
	fcb $f,$0
	fcb $80,$00

PAT17
	fcb $f,$1b
	fcb $f,$1b
	fcb $f,$1b
	fcb $f,$1b
	fcb $f,$1b
	fcb $f,$1b
	fcb $f,$1b
	fcb $f,$1b
	fcb $f,$1b
	fcb $f,$1b
	fcb $f,$1b
	fcb $f,$1b
	fcb $f,$1b
	fcb $f,$1b
	fcb $f,$1b
	fcb $f,$1b
	fcb $80,$00

PAT18
	fcb $0,$f
	fcb $0,$f
	fcb $0,$f
	fcb $0,$f
	fcb $0,$f
	fcb $0,$f
	fcb $0,$f
	fcb $0,$f
	fcb $0,$0
	fcb $0,$0
	fcb $0,$0
	fcb $0,$0
	fcb $0,$0
	fcb $0,$0
	fcb $0,$0
	fcb $0,$0
	fcb $80,$00

PAT19
	fcb $27,$27
	fcb $2e,$2e
	fcb $0,$0
	fcb $27,$0
	fcb $2e,$0
	fcb $0,$0
	fcb $0,$27
	fcb $0,$2e
	fcb $1b,$0
	fcb $1b,$27
	fcb $1b,$2e
	fcb $16,$0
	fcb $16,$27
	fcb $16,$2e
	fcb $12,$0
	fcb $12,$0
	fcb $80,$00

PAT20
	fcb $27,$27
	fcb $2e,$2e
	fcb $0,$0
	fcb $27,$0
	fcb $2e,$0
	fcb $0,$0
	fcb $0,$27
	fcb $0,$2e
	fcb $d,$0
	fcb $d,$27
	fcb $d,$2e
	fcb $d,$0
	fcb $d,$27
	fcb $d,$2e
	fcb $d,$0
	fcb $d,$0
	fcb $80,$00

PAT21
	fcb $27,$27
	fcb $2e,$2e
	fcb $0,$0
	fcb $27,$0
	fcb $2e,$0
	fcb $0,$0
	fcb $0,$27
	fcb $0,$2e
	fcb $d,$0
	fcb $d,$27
	fcb $d,$2e
	fcb $11,$0
	fcb $11,$27
	fcb $11,$2e
	fcb $14,$0
	fcb $14,$0
	fcb $80,$00

PAT22
	fcb $27,$27
	fcb $2e,$2e
	fcb $0,$0
	fcb $27,$0
	fcb $2e,$0
	fcb $0,$0
	fcb $0,$27
	fcb $0,$2e
	fcb $14,$0
	fcb $14,$27
	fcb $14,$2e
	fcb $14,$0
	fcb $14,$27
	fcb $14,$2e
	fcb $14,$0
	fcb $14,$0
	fcb $80,$00

PAT23
	fcb $27,$27
	fcb $2e,$2e
	fcb $0,$0
	fcb $27,$0
	fcb $2e,$0
	fcb $0,$0
	fcb $0,$27
	fcb $0,$2e
	fcb $16,$0
	fcb $16,$27
	fcb $16,$2e
	fcb $16,$0
	fcb $16,$27
	fcb $16,$2e
	fcb $16,$0
	fcb $16,$0
	fcb $80,$00

PAT24
	fcb $1b,$22
	fcb $1b,$2e
	fcb $f,$2c
	fcb $f,$27
	fcb $1e,$1b
	fcb $1e,$2e
	fcb $f,$2c
	fcb $f,$27
	fcb $20,$1e
	fcb $20,$2e
	fcb $f,$2c
	fcb $f,$27
	fcb $22,$20
	fcb $22,$2e
	fcb $f,$2c
	fcb $f,$27
	fcb $80,$00

PAT25
	fcb $1b,$22
	fcb $1b,$2e
	fcb $d,$2c
	fcb $d,$27
	fcb $1e,$1b
	fcb $1e,$2e
	fcb $d,$2c
	fcb $d,$27
	fcb $20,$1e
	fcb $20,$2e
	fcb $d,$2c
	fcb $d,$27
	fcb $22,$20
	fcb $22,$2e
	fcb $d,$2c
	fcb $d,$27
	fcb $80,$00

PAT26
	fcb $1b,$22
	fcb $1b,$33
	fcb $b,$2e
	fcb $b,$2a
	fcb $1e,$1b
	fcb $1e,$33
	fcb $b,$2e
	fcb $b,$2a
	fcb $20,$1e
	fcb $20,$33
	fcb $b,$2e
	fcb $b,$2a
	fcb $22,$20
	fcb $22,$33
	fcb $b,$2e
	fcb $b,$2a
	fcb $80,$00

PAT27
	fcb $1b,$22
	fcb $1b,$31
	fcb $a,$2e
	fcb $a,$29
	fcb $1e,$1b
	fcb $1e,$31
	fcb $a,$2e
	fcb $a,$29
	fcb $20,$1e
	fcb $20,$31
	fcb $a,$2e
	fcb $a,$29
	fcb $22,$20
	fcb $22,$31
	fcb $a,$2e
	fcb $a,$29
	fcb $80,$00

PAT28
	fcb $27,$27
	fcb $2e,$2e
	fcb $0,$0
	fcb $27,$0
	fcb $2e,$0
	fcb $0,$0
	fcb $0,$27
	fcb $0,$2e
	fcb $16,$22
	fcb $16,$22
	fcb $15,$21
	fcb $14,$20
	fcb $13,$1f
	fcb $12,$1e
	fcb $11,$1d
	fcb $10,$1c
	fcb $80,$00

PAT29
	fcb $1b,$22
	fcb $1b,$2e
	fcb $0,$2c
	fcb $0,$27
	fcb $1e,$1b
	fcb $1e,$2e
	fcb $0,$2c
	fcb $0,$27
	fcb $20,$1e
	fcb $20,$2e
	fcb $0,$2c
	fcb $0,$27
	fcb $22,$20
	fcb $22,$2e
	fcb $0,$2c
	fcb $0,$27
	fcb $80,$00

PAT30
	fcb $19,$22
	fcb $19,$2e
	fcb $0,$2c
	fcb $0,$27
	fcb $1e,$1b
	fcb $1e,$2e
	fcb $0,$2c
	fcb $0,$27
	fcb $20,$1e
	fcb $20,$2e
	fcb $0,$2c
	fcb $0,$27
	fcb $22,$20
	fcb $22,$2e
	fcb $0,$2c
	fcb $0,$27
	fcb $80,$00

PAT31
	fcb $17,$22
	fcb $17,$33
	fcb $0,$2e
	fcb $0,$2a
	fcb $1e,$1b
	fcb $1e,$33
	fcb $0,$2e
	fcb $0,$2a
	fcb $20,$1e
	fcb $20,$33
	fcb $0,$2e
	fcb $0,$2a
	fcb $22,$20
	fcb $22,$33
	fcb $0,$2e
	fcb $0,$2a
	fcb $80,$00

PAT32
	fcb $16,$22
	fcb $16,$31
	fcb $0,$2e
	fcb $0,$29
	fcb $1e,$1b
	fcb $1e,$31
	fcb $0,$2e
	fcb $0,$29
	fcb $20,$1e
	fcb $20,$31
	fcb $0,$2e
	fcb $0,$29
	fcb $22,$20
	fcb $22,$31
	fcb $0,$2e
	fcb $0,$29
	fcb $80,$00

PAT33
	fcb $f,$f
	fcb $f,$f
	fcb $f,$f
	fcb $f,$f
	fcb $f,$f
	fcb $f,$f
	fcb $f,$f
	fcb $f,$f
	fcb $f,$f
	fcb $f,$f
	fcb $f,$f
	fcb $f,$f
	fcb $f,$f
	fcb $f,$f
	fcb $f,$f
	fcb $f,$f
	fcb $80,$00

		.end
